import 'package:flutter/material.dart';

class AlignRoute extends StatefulWidget {
  const AlignRoute({Key? key}) : super(key: key);

  @override
  _AlignRouteState createState() => _AlignRouteState();
}

class _AlignRouteState extends State<AlignRoute> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('align对齐'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(8.0),
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(
                height: 120,
                width: 120,
                color: Colors.blue[200],
                child: const Align(
                  alignment: Alignment.topRight,
                  child: FlutterLogo(size: 100),
                ),
              ),
              Container(
                height: 120,
                width: 120,
                color: Colors.blue.shade50,
                child: const Align(
                  alignment: Alignment(10, 0),
                  child: FlutterLogo(size: 100),
                ),
              ),
              Container(
                height: 120,
                width: 120,
                color: Colors.blue.shade50,
                child: const Align(
                  alignment: FractionalOffset(20, 20),
                  child: FlutterLogo(size: 100),
                ),
              ),
              const DecoratedBox(
                decoration: BoxDecoration(color: Colors.red),
                child: Center(
                  child: const Text('xxx'),
                ),
              ),
              const DecoratedBox(
                decoration: BoxDecoration(color: Colors.red),
                child: Center(
                  widthFactor: 1,
                  heightFactor: 1,
                  child: const Text('666'),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
